You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

filename-regex

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filename-regex

Regular expression for matching file names, with or without extension.

0.1.0
Source
npmnpm
Version published
Weekly downloads
2.8M
-16.51%
Maintainers
1
Weekly downloads
 
Created

What is filename-regex?

The filename-regex npm package is used to match the filename part of a file path. It provides a simple regular expression for extracting filenames from paths, which can be useful in various file manipulation and validation tasks.

What are filename-regex's main functionalities?

Extract Filename from Path

This feature allows you to extract the filename from a given file path using a regular expression.

const filenameRegex = require('filename-regex');
const path = '/path/to/file.txt';
const match = path.match(filenameRegex());
console.log(match[0]); // Output: 'file.txt'

Validate Filename

This feature allows you to validate if a given string is a valid filename using the regular expression provided by the package.

const filenameRegex = require('filename-regex');
const filename = 'file.txt';
const isValid = filenameRegex().test(filename);
console.log(isValid); // Output: true

Other packages similar to filename-regex

Keywords

base

FAQs

Package last updated on 28 Dec 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts